﻿using ConfExpert.Forms.Base;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

using DevTeam;
using DevExpress.XtraEditors;

namespace ConfExpert.Forms.Depo.Istek
{
    public partial class IstekOnayi : XForm
    {
        public string xmlData;
        DataTable dataTable;

        public IstekOnayi(DataTable dataTable)
        {
            InitializeComponent();
            this.dataTable = dataTable;
        }

        private void IstekOnayi_Load(object sender, EventArgs e)
        {
            this.Text = "Satış";
            gridView1.Init(dataTable);
            gridView1.FormatAsNumber(1, "Qty");
            gridView1.BestFitColumns();
        }

        private void bbiKaydet_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            gridView1.EndEditing();
            for (int i = 0; i < gridView1.RowCount; ++i)
            {
                if (gridView1.GetRowCellValue(gridView1.GetRowHandle(i), gridView1.Columns["Fiyat"]).ToInt(-1) == -1)
                {
                    XtraMessageBox.Show("Kumaş Fiyatlarının Tamamı Girilmelidir!", "Uyarı");
                    return;
                }
            }
            this.DialogResult = System.Windows.Forms.DialogResult.OK;
            xmlData = gridView1.Serialize();
        }
    }
}
